﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
public partial class Main_Inventory_PurchaseOrderRevision : System.Web.UI.Page
{
    Datautility DU = new Datautility();
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["userid"] == null)
        {
            Response.Redirect("~/SessionExpired.aspx");
        }
        if (!IsPostBack)
        {
            BindPurchaseOrder();
        }
    }
    protected void BindPurchaseOrder()
    {
        string SqlPurchaseOrder = "select Distinct ACC_POMAIN.POID as POID,(PoPrefix+'/'+PoVoucherNo+'/'+PoSuffix) AS POORDERNO from ACC_POMAIN inner join IVR_TRAN_MAIN on ACC_POMAIN.POID!=IVR_TRAN_MAIN.POID where ACC_POMAIN.[Status]=8 and ACC_POMAIN.stages<>6 and ACC_POMAIN.shortclose=0 ";
        DataTable DtPurchaseOrder = DU.getdata(SqlPurchaseOrder);
        if (DtPurchaseOrder.Rows.Count > 0)
        {
            ddlPurchaseOrderRevision.DataSource = DtPurchaseOrder;
            ddlPurchaseOrderRevision.DataTextField = "POORDERNO";
            ddlPurchaseOrderRevision.DataValueField = "POID";
            ddlPurchaseOrderRevision.DataBind();
            ddlPurchaseOrderRevision.Items.Insert(0, new ListItem("- Select Purchase Order -", "0"));
        }
    }
    protected void ddlPurchaseOrderRevision_SelectedIndexChanged(object sender, EventArgs e)
    {
        Response.Redirect("PurcahseManager.aspx?Poid=" + ddlPurchaseOrderRevision.SelectedValue);
    }
}